home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 183 / dpcs0503.iso / Extras / Content / Images / Artbeats / WebStockDemo / XTRAS / WebStock.dxr / 00175_loop toggle.ls < prev    next >
Encoding:
Text File  |  1998-11-11  |  2.8 KB  |  70 lines

  1. property standardImage, alternateImage, toggleImage, toggleOffImage, toggled
  2. global infoName
  3.  
  4. on mouseWithin me
  5.   set infoSprite to sprite(the spriteNum of me)
  6.   set infoMember to the memberNum of sprite infoSprite
  7.   set infoName to the name of member infoMember
  8.   put infoName into field "info"
  9. end
  10.  
  11. on mouseEnter me
  12.   if toggled = 0 then
  13.     set the member of sprite the spriteNum of me to the alternateImage of me
  14.   else
  15.     set the member of sprite the spriteNum of me to the toggleImage of me
  16.   end if
  17. end
  18.  
  19. on mouseUp me
  20.   if toggled = 0 then
  21.     set the member of sprite the spriteNum of me to the toggleImage of me
  22.     set toggled to 1
  23.   else
  24.     set the member of sprite the spriteNum of me to the alternateImage of me
  25.     set toggled to 0
  26.   end if
  27.   puppetSound("spanx")
  28.   updateStage()
  29.   setMovieLoop()
  30. end
  31.  
  32. on mouseLeave me
  33.   if toggled = 1 then
  34.     set the member of sprite the spriteNum of me to the toggleOffImage of me
  35.   else
  36.     set the member of sprite the spriteNum of me to the standardImage of me
  37.   end if
  38.   put EMPTY into field "info"
  39. end
  40.  
  41. on setMovieLoop
  42.   if toggled = 1 then
  43.     set the loop of member "MovieMember1" to 1
  44.     set the loop of member "MovieMember2" to 1
  45.     if movieSprite(52) then
  46.       set the movieRate of sprite 52 to 1
  47.     end if
  48.     set the member of sprite 58 to "pause off"
  49.     killAutoRepeat()
  50.   else
  51.     set the loop of member "MovieMember1" to 0
  52.     set the loop of member "MovieMember2" to 0
  53.   end if
  54. end
  55.  
  56. on beginSprite me
  57.   set the standardImage of me to the member of sprite the spriteNum of me
  58.   set toggled to 0
  59.   set memref to the member of sprite the currentSpriteNum
  60.   set castLibNum to the castLibNum of memref
  61.   set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  62.   set alternateImage to memdefault
  63.   set toggleImage to member "straight on"
  64.   set toggleOffImage to member "straight off"
  65. end
  66.  
  67. on getBehaviorDescription
  68.   return "Change the sprite's cast member when the mouse rolls over the current sprite and toggles image on mouseDown." & RETURN & "To set up you toggle button you will need 4 button states placed in the cast in this order:" & RETURN & "    normal state" & RETURN & "    mouseOver state" & RETURN & "    mouseOver and toggled state" & RETURN & "    toggled normal" & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Use Next Member - Turn this option on to automatically display the next cast member in the cast when mouse rolls over the sprite." & RETURN & "ΓÇó Rollover Cast Member - Choose a specific cast member to appear when the mouse rolls over the sprite. This setting is ignored if Use Next Member is on." & RETURN & "ΓÇó Toggled Cast Member(on) - Use this option to select the toggled image when the mouse is still over it." & RETURN & "ΓÇó Toggled Cast Member(off) - Use this option to select the toggled image when the mouse is rolled of it."
  69. end
  70.